# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 02_字典的常见操作&遍历.py
# Time: 19:58


infor = {"name":"laowang","age":23}
print(len(infor))
# 获取key值
print(infor.keys())
# 获取value值
print(infor.values())
print(infor.get("names")) # 查找name，没有不会报错
print(infor["name"]) # 查找name，没有则会报错
# print([x for x in infor.keys()])
# 获取key，value（用元组封装起来）
for i in infor.items():
    print(i)